<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="http://hongweizhiyuan.oss-cn-hangzhou.aliyuncs.com/layui/css/layui.css"/>
</head>
<body>

<script src="http://hongweizhiyuan.oss-cn-hangzhou.aliyuncs.com/layui/layui.js"></script>
<script>
    //一般直接写在一个js文件中
    layui.use(['layer', 'form'], function () {
        var layer = layui.layer
            , form = layui.form;

        layer.open({
            type: 2,
            content: 'iframe.html',
            success: function (layero, index) {
                console.log(layero);
                console.log(index);
                var body = layer.getChildFrame('body', index);
                console.log(body);
                var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                console.log(iframeWin);
                console.log(body.html()); //得到iframe页的body内容
                body.find('input').val('Hi，我是从父页来的')
                body.find("#test").val('china')
            }
        });
    });
</script>
</body>
</html>